package com.yaxin.outsourcing.domain.Converter;


import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.yaxin.outsourcing.enums.PersonStatus;
import org.springframework.stereotype.Component;

@Component
public class PersonStatusConverter implements Converter<PersonStatus> {
    @Override
    public Class<PersonStatus> supportJavaTypeKey() {
        return PersonStatus.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public WriteCellData<?> convertToExcelData(PersonStatus value,
                                               ExcelContentProperty contentProperty,
                                               GlobalConfiguration globalConfiguration) {
        return new WriteCellData<>(value.getDesc()); // 自定义输出格式
    }
}
